﻿using System;


namespace BizElements.BusinessLayer
{
    /// <summary>
    /// Indicates how an object should be locked.
    /// </summary>
    /// <seealso cref="ILockManager"/><seealso cref="LockManagerFactory"/><seealso cref="LockUtil"/>
    [Serializable]
    public enum LockMode
    {
        #region Enumerated values.

        /// <summary>
        /// The default mode implemented by a <see cref="ILockManager"/> will be used.
        /// </summary>
        /// <remarks>In most scenarios shared locks are used by default.</remarks>
        Default,

        /// <summary>
        /// Exclusive lock prevents access to a locked object by concurrent transactions.
        /// No other transactions can read or modify the object locked with an exclusive lock.
        /// </summary>
        /// <remarks>Use this mode only if it becomes critical that a business transaction must always have 
        /// the most recent data, regardless of its intention to edit it, since this strategy has the potential 
        /// to severely restrict a system's concurrency.</remarks>
        Exclusive,

        /// <summary>
        /// Shared lock allows concurrent transactions to read the locked object. 
        /// No other transactions can modify the object while shared lock exists on it. 
        /// </summary>
        /// <remarks>What this locking scheme ignores is the reading of data, so if it's not critical 
        /// that a view session has the most recent data this strategy will suffice.</remarks>
        Shared

        #endregion
    }
}